Ext.define('framenet.view.frameCombo', {
	extend: 'Ext.form.field.ComboBox',
	alias: 'widget.frameCombo',
	
	constructor: function(cfg) {
        var me = this;
        cfg = cfg || {};
        
        me.callParent([Ext.apply({
        	mode: 'remote',
            store: Ext.create('js.app.base.store.comboStore', {entity: cfg.entity, valueField: cfg.valueField, displayField: cfg.displayField}),
            valueField: cfg.valueField,
            displayField: cfg.displayField,
            emptyText: 'Seleccionar ' + cfg.displayField + '...',
            selectOnFocus: true,
            typeAhead: true,
            editable: true,
            triggerAction: 'all',
            queryDelay: 500,
            selectOnFocus:true,
            hideTrigger: false,
            queryParam:  'filter',
            listeners: { 
                beforequery: function(queryEvent, eOpts)	{
                	if (queryEvent.query)	{
                    	queryEvent.query = '[{"property": "' + this.displayField + '" ,"value": "' + queryEvent.query + '"}]';
                	}
                }
            }
        }, cfg)]);
	}
});
